package com.ushio.gougouwangguo.controller;

import com.ushio.commonmodule.pojo.result.Result;
import com.ushio.gougouwangguo.entity.vo.UserTaskCellVo;
import com.ushio.gougouwangguo.service.IUserTaskCellService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 任务单元格 前端控制器
 * </p>
 *
 * @author 张文凯
 * @since 2025-10-26
 */
@RestController
@RequestMapping("/userTaskCell")
public class UserTaskCellController {

    @Autowired
    IUserTaskCellService iUserTaskCellService;
    @GetMapping("/architecture")
    public Result<List<UserTaskCellVo>> getUserTaskCellArchitecture(){

        try{

            List<UserTaskCellVo> userTaskCellVos =  iUserTaskCellService.getUserTaskCellArchitecture();

            return Result.success(userTaskCellVos);

        }catch (Exception e){

            e.printStackTrace();

            return Result.fail(e.getMessage());

        }
    }

    @GetMapping("/forest")
    public Result<List<UserTaskCellVo>> getUserTaskCellForest(){

        try{

            List<UserTaskCellVo> userTaskCellVos =  iUserTaskCellService.getUserTaskCellForest();

            return Result.success(userTaskCellVos);

        }catch (Exception e){

            e.printStackTrace();

            return Result.fail(e.getMessage());

        }
    }

}
